<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Cadastro Automovel</title>
	 <link rel="StyleSheet" type="text/css" href="css/fonte.css" media="screen"/>
</h:head>
<h:body>
	<h:form>
		<h:panelGrid columns="2">
		Marca: <h:inputText value="#{automovelBean.automovel.marca}" />
		Modelo: <h:inputText value="#{automovelBean.automovel.modelo}" />
		Ano de fabricação: <h:inputText
				value="#{automovelBean.automovel.anoFabricacao}" />
		Ano do modelo: <h:inputText
				value="#{automovelBean.automovel.anoModelo}" />
		Observações: <h:inputTextarea
				value="#{automovelBean.automovel.observacoes}" />

			<h:commandButton value="Salvar"
				action="#{automovelBean.salva(automovelBean.automovel)}" />
		</h:panelGrid>
		<p:dataTable value="#{automovelBean.automoveis}" var="automovel">
		
			<p:column headerText="Codigo">
				<h:outputText value="#{automovel.id}" />
			</p:column>
			
			<p:column headerText="Marca">
				<h:outputText value="#{automovel.marca}" />
			</p:column>
			
			<p:column headerText="Modelo">
				<h:outputText value="#{automovel.modelo}" />
			</p:column>
			
			<p:column headerText="Ano Modelo">
				<h:outputText value="#{automovel.anoModelo}" />
			</p:column>
			
			<p:column headerText="Ano Fabricacao">
				<h:outputText value="#{automovel.anoFabricacao}" />
			</p:column>
			
			<p:column headerText="Id">
				<h:outputText value="#{automovel.observacoes}" />
			</p:column>
			
			<p:column headerText="Ações">
				<h:commandLink action="#{automovelBean.excluir(automovel)}">
					excluir
				</h:commandLink>
			</p:column>
		</p:dataTable>
	</h:form>
</h:body>
</html>